package com.woniuxy.cloud.util;


import java.util.Random;

/**
 * 共用工具
 * @author 周川雄
 * @date 2022/1/3 20:38
 */
public class CommonsUtil {

    /**
     * 获取随机验证码
     *
     * @param length
     * @return
     */
    public String getRandomString(int length) {
        String originString = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789";
        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < length; i++) {
            builder.append(originString.charAt(new Random().nextInt(originString.length())));
        }
        return String.valueOf(builder);
    }
}
